﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.IO;

namespace gpao2012
{
    public partial class import : DevExpress.XtraEditors.XtraUserControl
    {
        public import()
        {
            InitializeComponent();
        }

        private void imp_Click(object sender, EventArgs e)
        {
            // Create an OpenFileDialog to request a file to open.
            OpenFileDialog openFile1 = new OpenFileDialog();

            // Initialize the OpenFileDialog to look for RTF files.
            openFile1.DefaultExt = "*.conf";
            openFile1.Filter = "Fiche de confiquration|*.conf";

            // Determine whether the user selected a file from the OpenFileDialog.
            if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && openFile1.FileName.Length > 0)
            {
                // Load the contents of the file into the RichTextBox.
                //richTextBox1.LoadFile(openFile1.FileName, RichTextBoxStreamType.PlainText);



                String[] s = new String[20];
                s = File.ReadAllLines(openFile1.FileName);

                this.labelControl1.Text = "raison= " + ascII(s[0]);
                this.labelControl2.Text = "= " + ascII(s[7]);


            }
        }

      
        static string ascII(string s)
        {
            string c = "";
            for (int i = 0; i < s.Length; i++)
            {
                int ch;
                ch = (int)s[i];
                ch = ch + 30;

                c = Convert.ToChar(ch) + c;
            }
            return c;
        }
    }
}
